package ioc;

public class Hero {
    //姓名
    private String name;
    //年龄
    private Integer age;

    //编写一个构造方法
    public Hero(){
        //在Hero实例化时会运行构造方法
        System.out.println("Hero被实例化了");
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return "Hero{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}
